﻿namespace X2OPC.Core
{
    using System;
    using System.Runtime.InteropServices;

    [ComImport, Guid("F31DFDE2-07B6-11d2-B2D8-0060083BA1FB"), ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IOPCCommon
    {
        /// <summary>
        /// 设定位置信息 
        /// </summary>
        /// <param name="dwLcid"></param>
        /// <returns></returns>
        [PreserveSig]
        int SetLocaleID([In] int dwLcid);

        /// <summary>
        /// 取得位置信息
        /// </summary>
        /// <param name="pdwLcid"></param>
        /// <returns></returns>
        [PreserveSig]
        int GetLocaleID(out int pdwLcid);

        /// <summary>
        /// 查询可用的位置ID
        /// </summary>
        /// <param name="pdwCount"></param>
        /// <param name="pdwLcid"></param>
        /// <returns></returns>
        [PreserveSig]
        int QueryAvailableLocaleIDs(out int pdwCount, out IntPtr pdwLcid);

        /// <summary>
        /// 取得错误信息字符串
        /// </summary>
        /// <param name="dwError"></param>
        /// <param name="ppString"></param>
        /// <returns></returns>
        [PreserveSig]
        int GetErrorString([In] int dwError, [MarshalAs(UnmanagedType.LPWStr)] out string ppString);

        /// <summary>
        /// 设定Clinet的名称
        /// </summary>
        /// <param name="szName"></param>
        /// <returns></returns>
        [PreserveSig]
        int SetClientName([In, MarshalAs(UnmanagedType.LPWStr)] string szName);
    }
}
